/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBeans;

import ejb.ServicioResponsable;
import entities.Persona;
import entities.Responsable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author Agapo
 */
@ManagedBean
@RequestScoped
public class ResponsableBean {
    @EJB
    private ServicioResponsable sr;
    private Responsable repsonsable;
    
    /** Creates a new instance of ResponsableBean */
    public ResponsableBean() {
    }

    public Responsable getRepsonsable() {
        return repsonsable;
    }

    public void setRepsonsable(Responsable repsonsable) {
        this.repsonsable = repsonsable;
    }

    @PostConstruct
    public void inicializar(){
        repsonsable=new Responsable();
        repsonsable.setIdPersona(new Persona());
    }
    
    public List<Responsable> verTodos(){
        return sr.verResponsables();
    }
    public void guardar(){
        sr.altaResponsable(repsonsable);
    }
    
}
